home *** CD-ROM | disk | FTP | other *** search
- /*=====[ The TesSeRact(TM) CXL User Interface Development System ]======*
- | Copyright (c) 1987-1990, Innovative Data Concepts. All Rights Reserved
- |
- | This Library is part of IDC's TesSeRact Development Tools product
- | line. For information about other IDC products, call 1-215-884-3373.
- *----------------------------------------------------------------------*
- | <TCXLwin.h> : Public definitions and prototypes for TCXL windowing
- | system.
- *----------------------------------------------------------------------*
- | PGS : $Id: tcxlwin.h 5.51 90/10/01 00:00:00 MLM Release Locker: MLM $
- | $Log: tcxlwin.h $
- | Revision 5.51 90/10/01 00:00:00 MLM
- | TCXL 5.51
- |
- *======================================================================*/
- #ifndef _TCXLwin_
- # define _TCXLwin_ 1
- # ifndef _TCXLvid_
- # include <TCXLvid.h> /* video definitions */
- # endif
- # ifndef _TCXLerr_
- # include <TCXLerr.h> /* error definitions */
- # endif
- /*- Box types ----------------------------*/
- #define BOX_SNG 0x00 /* all single */
- #define BOX_DBL 0x01 /* all double */
- #define BOX_VER 0x02 /* horiz single, vert double */
- #define BOX_HOR 0x03 /* horiz double, vert single */
- #define BOX_HVY 0x04 /* heavy lines */
- #define BOX_SPA 0x05 /* spaces */
- /*- Border sides -------------------------*/
- #define BRD_TOP 0x00 /* Top */
- #define BRD_BOT 0x01 /* Bottom */
- #define BRD_LFT 0x02 /* Left */
- #define BRD_RGT 0x03 /* Right */
- /*- Wcenter(), WpopUp centering flags ----*/
- #define CNT_HOR 0x01 /* Horizontal */
- #define CNT_VER 0x02 /* Vertical */
- #define CNT_CNT 0x03 /* Both */
- /*- Direction codes ----------------------*/
- #define DIR_DWN 0x00 /* Down */
- #define DIR_UP 0x01 /* Up */
- #define DIR_LFT 0x02 /* Left */
- #define DIR_RGT 0x03 /* Right */
- /*- Wtitle() title positions -------------*/
- #define TTL_LFT 0x01 /* Left */
- #define TTL_CNT 0x02 /* Center */
- #define TTL_RGT 0x03 /* Right */
-
- /*------------------[ Data objects and access macros ]------------------*/
-
- TYP struct Box BoxT, *BoxP;
- TYP struct Ttl TtlT, *Ttlp;
- TYP struct Wctl WctlT, *WctlP;
- TYP struct Wdf WdfT, *WdfP;
-
- struct Box /*-[ Window-frame object ]-------*/
- { BytT btyp; /* 00|00 : type */
- BytT batr; /* 01|01 : attribute */
- }; /* 02|02 ]-----------------------*/
- #define BoxTyp(b) ((b).btyp)
- #define BoxAtr(b) ((b).batr)
-
- struct Ttl /*-[ Window-title object ]-------*/
- { ChrP tstr; /* 00|00 : string */
- BytT tpos; /* 02|04 : position */
- AtrT tatr; /* 03|05 : attribute */
- }; /* 04|06 ]-----------------------*/
- #define TtlStr(t) ((t).tstr)
- #define TtlPos(t) ((t).tpos)
- #define TtlAtr(t) ((t).tatr)
-
- struct Wctl /*-[ Window-control object ]--------*/
- { WdfP wact; /* 00|00 : active window */
- WdfP whid; /* 02|04 : top hidden window */
- VOID (CTYP *wfun) /* 04|08 : fill-function */
- (WrdT, WrdT, IntT, IntT);
- WndT whdl; /* 06|0C : last handle assigned */
- TagT whlp; /* 08|0E : current help category */
- IntT wopn; /* 0A|10 : total open windows */
- BytT wesc; /* 0C|12 : [Esc] checking ? 1 : 0 */
- BytT wtab; /* 0D|13 : TTY output tab width */
- BytT wfil; /* 0E|14 : fill character */
- BytT wflg; /* 0F|15 : reserved flag byte */
- }; /* 10|16 ]--------------------------*/
-
- GBL WctlT CDC _WinCtl; /*- global window-control object ---------*/
- #define WctlAct (_WinCtl.wact) /* active window */
- #define WctlHid (_WinCtl.whid) /* top hidden window */
- #define WctlFun (_WinCtl.wfun) /* fill function */
- #define WctlHdl (_WinCtl.whdl) /* last handle */
- #define WctlHlp (_WinCtl.whlp) /* help category */
- #define WctlOpn (_WinCtl.wopn) /* total open */
- #define WctlEsc (_WinCtl.wesc) /* [Esc] check */
- #define WctlTab (_WinCtl.wtab) /* tab width */
- #define WctlFil (_WinCtl.wfil) /* fill char */
- #define WctlFlg (_WinCtl.wflg) /* flag byte */
-
- struct Wdf /*-[ Window-definition object ]--*/
- { WdfP wprv; /* 00|00 : previous WdfT */
- WdfP wnxt; /* 02|04 : next WdfT */
- VcelP wbfr; /* 04|08 : buffer */
- VcelP wsbf; /* 06|0C : shadow buffer */
- TtlT wttl; /* 08|10 : title */
- WndT whdl; /* 0C|14 : handle */
- TagT whlp; /* 0E|16 : help category */
- VposT wbeg; /* 10|18 : start position */
- VposT wend; /* 12|1A : end position */
- VposT wpos; /* 14|1C : cursor position */
- BoxT wfrm; /* 16|1E : border */
- AtrT wdat; /* 18|20 : default attribute */
- AtrT wcat; /* 19|21 : current attribute */
- AtrT wsat; /* 1A|22 : shadow attribute */
- BytT wbrd; /* 1B|23 : border ? 1 : 0 */
- }; /* 1C|24 ]-----------------------*/
-
- #define WdfPrv(w) ((w)->wprv) /* previous WdfT */
- #define WdfNxt(w) ((w)->wnxt) /* next WdfT */
- #define WdfBfr(w) ((w)->wbfr) /* buffer */
- #define WdfSbf(w) ((w)->wsbf) /* shadow buffer */
- #define WdfTtl(w) ((w)->wttl) /* title */
- #define WdfTtlS(w) (TtlStr(WdfTtl(w))) /* string */
- #define WdfTtlP(w) (TtlPos(WdfTtl(w))) /* position */
- #define WdfTtlA(w) (TtlAtr(WdfTtl(w))) /* attribute */
- #define WdfHdl(w) ((w)->whdl) /* handle */
- #define WdfHlp(w) ((w)->whlp) /* help category */
- #define WdfBeg(w) ((w)->wbeg) /* start position */
- #define WdfBegW(w) (VposW(WdfBeg(w))) /* word */
- #define WdfBegC(w) (VposC(WdfBeg(w))) /* col */
- #define WdfBegR(w) (VposR(WdfBeg(w))) /* row */
- #define WdfEnd(w) ((w)->wend) /* end position */
- #define WdfEndW(w) (VposW(WdfEnd(w))) /* word */
- #define WdfEndC(w) (VposC(WdfEnd(w))) /* col */
- #define WdfEndR(w) (VposR(WdfEnd(w))) /* row */
- #define WdfPos(w) ((w)->wpos) /* cursor position */
- #define WdfPosW(w) (VposW(WdfPos(w))) /* word */
- #define WdfPosC(w) (VposC(WdfPos(w))) /* col */
- #define WdfPosR(w) (VposR(WdfPos(w))) /* row */
- #define WdfFrm(w) ((w)->wfrm) /* border */
- #define WdfFrmT(w) (BoxTyp(WdfFrm(w))) /* type */
- #define WdfFrmA(w) (BoxAtr(WdfFrm(w))) /* attribute */
- #define WdfDat(w) ((w)->wdat) /* default attribute */
- #define WdfCat(w) ((w)->wcat) /* current attribute */
- #define WdfSat(w) ((w)->wsat) /* shadow attribute */
- #define WdfBrd(w) ((w)->wbrd) /* border */
-
- /*------------------------[ Function prototypes ]-----------------------*
- | [A] indicates active window in comments
- */
- #ifdef __cplusplus /* no mangling, please */
- extern "C" {
- #endif
- /*- general ---------------------*/
- IntT CTYP Wactiv(WndT wh); /* Activate window <wh> */
- IntT CTYP WcloseAll(NOARG); /* Close all windows */
- ChrP CTYP WerrMsg(NOARG); /* get error-message text */
- VOID CTYP Werror(NOARG); /* exit with error-message */
- WndT CTYP Windowat(IntT sr, /* Handle of window at position */
- IntT sc);
- WdfP CTYP WinLoc(WndT wh); /* Find window by handle */
- IntT Wisactiv(WndT a); /* Test for active handle */
- WndT CTYP Wopen(IntT sr, IntT sc, /* Open window */
- IntT er, IntT ec, IntT bt, IntT ba, IntT wa);
- IntT CTYP Wperror(ChrP mp); /* Display error window */
- WndT CTYP WpopUp(IntT cf, IntT sr, /* Open centered window */
- IntT sc, IntT er, IntT ec, IntT bt, IntT ba, IntT wa);
- VOID CTYP Wrestore(VcelP wb); /* Restore saved window */
- VcelP CTYP Wsave(IntT sr, IntT sc, /* Save window */
- IntT er, IntT ec);
- VOID WsetEsc(IntT a); /* Enable/Disable [Esc] key */
- VOID WsetFil(IntT a); /* Set fill char */
- IntT CTYP WsetFun( /* Set fill function */
- VOID (CTYP *f)(WrdT, WrdT, IntT, IntT));
- VOID WsetTab(IntT a); /* Set tab-width */
- IntT CTYP WsetTxt(IntT a); /* Set text attr */
- IntT CTYP Wunhide(WndT wh); /* Unhide window <wh> */
- IntT CTYP Wunlink(WndT wh); /* Unlink window <wh> */
- IntT CTYP Wwprints(WndT wh, IntT wr, /* Put string to window <wh> */
- IntT wc, IntT at, ChrP ps);
- /*- active window movement ------*/
- IntT CTYP Wcenter(IntT cf); /* Center window on screen [A] */
- IntT CTYP Wclose(NOARG); /* Close window [A] */
- WndT CTYP Wcopy(IntT nr, IntT nc); /* Copy window [A] */
- IntT CTYP Wdrag(IntT df); /* Drag one row or col [A] */
- IntT CTYP Wdump(NOARG); /* Dump window to printer [A] */
- WndT CTYP Whandle(NOARG); /* Get active handle [A] */
- IntT CTYP Whide(NOARG); /* Hide window [A] */
- IntT CTYP Wmove(IntT sr, IntT sc); /* Move window [A] */
- IntT CTYP Wsize(IntT nr, IntT nc); /* Resize window [A] */
- IntT CTYP Wslide(IntT sr,IntT sc); /* Slide window [A] */
- /*- active window-control -------*/
- IntT CTYP WchgAtr(IntT ba, IntT wa); /* Change window/border attr [A] */
- IntT CTYP WchkBox(IntT sr, IntT sc, /* Check box coords [A] */
- IntT er, IntT ec);
- IntT CTYP WchkCol(IntT wc); /* Check column [A] */
- IntT CTYP WchkPos(IntT wr, IntT wc); /* Check position [A] */
- IntT CTYP WchkRow(IntT wr); /* Check row [A] */
- IntT Wclear(NOARG); /* Clear window to default [A] */
- IntT CTYP WclrEol(NOARG); /* Clear cursor to EOL [A] */
- IntT CTYP WclrEos(NOARG); /* Clear to end of window [A] */
- IntT CTYP WclrWin(IntT at); /* Clear window [A] */
- IntT CTYP WfilBox(IntT sr, IntT sc, /* Fill region [A] */
- IntT er, IntT ec, IntT ch,IntT at);
- IntT CTYP WlinDel(IntT wr, IntT df); /* Delete line [A] */
- IntT CTYP WlinIns(IntT wr, IntT di); /* Insert line [A] */
- IntT CTYP WscrBox(IntT sr, /* Scroll region [A] */
- IntT sc, IntT er,IntT ec, IntT n, IntT d);
- IntT CTYP WscrWin(IntT n, IntT d); /* Scroll window [A] */
- /*- active border, box drawing --*/
- IntT CTYP Wborder(IntT bt); /* Add border [A] */
- IntT CTYP Wbprintc(IntT bd, IntT of, /* Put char/attr on border [A] */
- IntT at, IntT ch);
- IntT CTYP WdrwBox(IntT sr, IntT sc, /* Draw internal box [A] */
- IntT er, IntT ec, IntT bt, IntT at);
- IntT CTYP WdrwHor(IntT sr, IntT sc, /* Draw horizontal line [A] */
- IntT nc, IntT bt, IntT at);
- IntT CTYP WdrwVer(IntT sr, IntT sc, /* Draw vertical line [A] */
- IntT n, IntT bt, IntT at);
- IntT CTYP Wmessage(ChrP ps, IntT bo, /* Put message on border [A] */
- IntT lo, IntT at);
- IntT CTYP Wtitle(ChrP ps, IntT tp, /* Put title on border [A] */
- IntT ta);
- /*- active window shadow --------*/
- IntT CTYP Wshadoff(NOARG); /* Remove shadow [A] */
- IntT CTYP Wshadow(IntT at); /* Add shadow [A] */
- /*- active window cursor --------*/
- VOID WcurGet(VposT rc); /* Get position [A] */
- IntT WcurPut(VposT rc); /* Put cursor [A] */
- IntT CTYP Wgotoxy(IntT wr, IntT wc); /* Set position [A] */
- IntT CTYP Wpgotoxy(IntT wr, /* Provisional position [A] */
- IntT wc);
- VOID WposGet(IntT r, IntT c); /* get cursor position as <r,c> */
- /*- Active Output / Current Cursor/Attrib */
- VOID CTYP WdupChr(IntT ch, IntT nd); /* Put duplicated char [A] */
- VOID CTYP WdupStr(ChrP ps,IntT nd); /* Put duplicated string [A] */
- IntT CTYP WputCen(ChrP ps); /* Put centered string [A] */
- IntT CTYP WputFmt(ChrP fs, ChrP ps); /* Format-string output [A] */
- VOID CTYP Wputc(IntT ch); /* Put char [A] */
- IntT CDC Wputf(ChrP fs, ...); /* Put printf() string [A] */
- VOID CTYP Wputs(ChrP ps); /* Put string [A] */
- VOID CTYP Wputns(ChrP ps, IntT wd); /* Put limited string [A] */
- IntT CTYP Wputrj(ChrP ps); /* Right-justify string/attr [A] */
- IntT CTYP Wputsw(ChrP ps); /* Put string with word-wrap [A] */
- /*- Active Output / Passed Cursor/Attrib -*/
- VOID CTYP WdupChrA(IntT wr, IntT wc, /* Put duplicated char/attr [A] */
- IntT at, IntT ch, IntT nd);
- VOID CTYP WdupStrA(IntT wr, IntT wc, /* Put duplicated str/attr [A] */
- IntT at, ChrP ps, IntT nd);
- IntT CTYP WprtCen(IntT wr, IntT at, /* Put centered string/attr [A] */
- ChrP ps);
- IntT CTYP WprtFmt(IntT wr, IntT wc, /* Format-string/attr output [A] */
- IntT at, ChrP fs, ChrP ps);
- IntT CTYP Wprtc(IntT wr, IntT wc, /* Put char/attr [A] */
- IntT at, IntT ch);
- IntT CDC Wprtf(IntT wr, IntT wc, /* Put printf() string/attr [A] */
- IntT at, ChrP fs, ...);
- VOID CTYP Wprtns(IntT wr, IntT wc, /* Put limited string/attr [A] */
- IntT at, ChrP ps, IntT wd);
- IntT CTYP Wprtrj(IntT wr, IntT wc, /* Right-justify string/attr [A] */
- IntT at, ChrP ps);
- IntT CTYP Wprts(IntT wr, IntT wc, /* Put string/attr [A] */
- IntT at, ChrP ps);
- IntT CTYP Wprtsw(IntT wr, IntT wc, /* Put string/attr with wrap [A] */
- IntT at, ChrP ps);
- WrdT CTYP WcurGt_(NOARG); /*- internals -------------------*/
- IntT CTYP WcurPt_(WrdT rc);
- #define Wclear() (WclrWin(WdfDat(WctlAct)))
- #define WcurGet(rc) (VposW(rc)=WcurGt_())
- #define WcurPut(rc) (WcurPt_(VposW(rc)))
- #define WsetFil(a) (WctlFil=(a))
- #define Wisactiv(a) ((a)==WdfHdl(WctlAct))
- #define WposGet(r,c) ((c)=MsInt(WcurGt_()); (r)=((c)>>8); (c)&=0xFF)
- #define WsetEsc(a) (WctlEsc=(a))
- #define WsetTab(a) (WctlTab=(((a)==0)?1:(a)))
- #ifdef __cplusplus
- }
- #endif
- #endif /* _TCXLwin_ : End of TCXLwin.h */